﻿<navigation:Page x:Class="ibba.src.norisk.page.PageReprocessamento" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:Toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
           xmlns:slc="clr-namespace:ibba.src.slcomponentes;assembly=ibba.src.slcomponentes"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  
           xmlns:src="clr-namespace:ibba.src.norisk"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           Title="Configuração de Parametros para Reprocessamento"
                 d:DesignHeight="768"
                 d:DesignWidth="1048">

    <UserControl.Resources>
        <src:ConverterDateTime x:Key="ConverterData"></src:ConverterDateTime>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Toolkit:BusyIndicator x:Name="activity">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="42"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid x:Name="gridHeader" Grid.ColumnSpan="2" Grid.Row="0" Background="#FFFFFFFF" HorizontalAlignment="Stretch" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions >
                        <ColumnDefinition />
                        <ColumnDefinition MinWidth="40" />
                    </Grid.ColumnDefinitions>

                    <Border Grid.Row="0" Background="#FF5C7590" Grid.ColumnSpan="6" HorizontalAlignment="Stretch" d:LayoutOverrides="GridBox">

                        <StackPanel Orientation="Horizontal" Width="160" Height="40" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right">
                            <Image  Margin="0,0,0,0" Width="160" Height="40" Source="../image/etq_confidencial_restrita.png" />
                        </StackPanel>

                    </Border>
                    <TextBlock Text="Parametrizações para Reprocessamento" FontSize="14" Foreground="#FFC4991C" 
        	            VerticalAlignment="Center" Width="Auto" HorizontalAlignment="Left" FontFamily="Verdana" Grid.Column="0" 
                        Margin="10,0,0,0" FontWeight="Bold" />
                </Grid>

                <StackPanel Orientation="Horizontal" Grid.Row="1">
                    <StackPanel>
                        <Border>
                            <slc:CustomContentPanel Name="panelConsultas" HeaderPadding="10,5" Margin="10,5,0,0"
                                BorderBrush="#FFD1D1D1" Header="Preencha os dados necessários"
                                HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Center" 
                                VerticalContentAlignment="Top" IsTabStop="True" CornerRadius="5"
                                Grid.Row="0" Grid.Column="0">

                                <StackPanel>

                                    <StackPanel Orientation="Horizontal" Margin="5,5,0,0">
                                        <Border Width="135">
                                            <TextBlock Text="Data Último Processamento:" Width="118" TextAlignment="Right" TextWrapping="Wrap" Margin="0,0,5,0" Height="32" VerticalAlignment="Center" />
                                        </Border>
                                        <Border Width="130">
                                            <TextBlock x:Name="txtDataReferencia" Text="//" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" FontSize="11" Margin="0" />
                                        </Border>
                                        <Border Width="135">
                                            <TextBlock Text="Data Referência para Carga:" TextAlignment="Right" TextWrapping="Wrap" Height="34" Width="113" VerticalAlignment="Center" />
                                        </Border>
                                        <Border>
                                            <controls:DatePicker Height="23" HorizontalAlignment="Left" Margin="0" x:Name="dtpDataCarga" VerticalAlignment="Top" IsTodayHighlighted="True" IsEnabled="False" SelectedDateChanged="dtpDataCarga_SelectedDateChanged" DateValidationError="dtpDataCarga_DateValidationError" />
                                        </Border>
                                        <Border>
                                            <TextBlock Text="Origem:" Margin="0,0,5,0" Width="88" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" />
                                        </Border>
                                        <Border>
                                            <ComboBox Height="23" HorizontalAlignment="Left" Name="cboOrigem" VerticalAlignment="Top" Width="200" DisplayMemberPath="NomeOrigem" IsEnabled="False"/>
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" Margin="5,5,0,0">
                                        <Border>
                                            <TextBlock Text="Seleciona Produto?" Width="130" TextAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" />
                                        </Border>
                                        <Border Width="130">
                                            <CheckBox Grid.Column="1" Height="16" HorizontalAlignment="Left" Name="checkProduto" VerticalAlignment="Top" Checked="checkProduto_Checked" Unchecked="checkProduto_Unchecked" IsEnabled="False"/>
                                        </Border>
                                        <Border Width="130">
                                            <TextBlock Text="Produto:" TextAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" />
                                        </Border>
                                        <Border>
                                            <sdk:AutoCompleteBox Grid.Column="1" Height="22" HorizontalAlignment="Left" Name="txtProduto" VerticalAlignment="Top" MinWidth="250" HorizontalContentAlignment="Left" KeyUp="txtProduto_KeyUp" TextChanged="txtProduto_TextChanged" FilterMode="Contains" IsEnabled="False" Margin="0,5,0,0" />
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" Margin="5,5,0,0">
                                        <Border >
                                            <TextBlock Text="Seleciona Modalidade?" Width="130" TextAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" />
                                        </Border>
                                        <Border Width="130">
                                            <CheckBox Grid.Column="1" Height="16" HorizontalAlignment="Left" Name="checkModalidade" VerticalAlignment="Top" Checked="checkModalidade_Checked" Unchecked="checkModalidade_Unchecked" IsEnabled="False"/>
                                        </Border>
                                        <Border Width="130">
                                            <TextBlock Text="Modalidade:" TextAlignment="Right" Margin="0,0,5,0" />
                                        </Border>
                                        <Border>
                                            <sdk:AutoCompleteBox Grid.Column="1" Height="22" HorizontalAlignment="Left" Text="{Binding DescricaoModalidade}" Name="txtModalidade" VerticalAlignment="Top" MinWidth="250" HorizontalContentAlignment="Left" FilterMode="Contains" IsEnabled="False" />
                                        </Border>
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" Margin="5,5,0,0">
                                        <Border Width="130">
                                            <TextBlock Text="Justificativa:" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0" />
                                        </Border>
                                        <Border >
                                            <ComboBox Grid.Column="1" Height="23" HorizontalAlignment="Left" Name="cboJustificativa" Width="200" IsEnabled="False" UseLayoutRounding="True" />
                                        </Border>
                                        <Border Width="130">
                                            <TextBlock Text="Observações:" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0" />
                                        </Border>
                                        <Border >
                                            <TextBox HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Verdana" FontSize="11" Width="300" TextWrapping="Wrap" Name="txtObservacoes" IsEnabled="False" Height="50" />
                                        </Border>
                                    </StackPanel>
                                </StackPanel>
                            </slc:CustomContentPanel>
                        </Border>
                        <Border  Margin="10,10,0,0">
                            <data:DataGrid x:Name ="grdParametros"  Margin="10,5,0,0"
                                    RenderTransformOrigin="0.5,0.5" 
        	                        Visibility="Visible" 
        	                        AlternatingRowBackground="#FFFCFCFC" 
        	                        RowBackground="#FFFCFCFC" 
        	                        AutoGenerateColumns="False"  
        	                        BorderBrush="#FFF8F8F8"
          	                        HorizontalScrollBarVisibility="Hidden"
                                    ItemsSource="{Binding}" HorizontalAlignment="Left">
                                <data:DataGrid.Columns>
                                    <data:DataGridTextColumn Header="Origem" Binding="{Binding NmOrigem}" MinWidth="60" IsReadOnly="True"/>
                                    <data:DataGridTextColumn Header="Data de Processamento" Binding="{Binding DtReferencia, Converter={StaticResource ConverterData}}" MinWidth="120" IsReadOnly="True"></data:DataGridTextColumn>
                                    <data:DataGridTextColumn Header="Data Origem dos Dados" Binding="{Binding DtReferenciaReprocessamento, Converter={StaticResource ConverterData}}" MinWidth="120" IsReadOnly="True"></data:DataGridTextColumn>
                                    <data:DataGridTextColumn Header="Justificativa" Binding="{Binding DscMotivo, Converter={StaticResource ConverterData}}" MinWidth="120" IsReadOnly="True"></data:DataGridTextColumn>
                                    <data:DataGridTextColumn Header="Usuário" Binding="{Binding CdUsuario}" MinWidth="120" IsReadOnly="True"></data:DataGridTextColumn>
                                    <data:DataGridTemplateColumn Width="90" IsReadOnly="True">
                                        <data:DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button x:Name="btnDetalhes" Height="28" Width="50" Click="btnDetalhes_Click">
                                                    <StackPanel Orientation="Vertical">
                                                        <Image Source="../image/search.png" Width="20" HorizontalAlignment="Left" Margin="5,1,0,7" />
                                                    </StackPanel>
                                                </Button>
                                            </DataTemplate>
                                        </data:DataGridTemplateColumn.CellTemplate>
                                    </data:DataGridTemplateColumn>
                                    <data:DataGridTemplateColumn Width="90" IsReadOnly="True">
                                        <data:DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button x:Name="btnExcluir" Height="28" Width="50" Click="btnExcluir_Click">
                                                    <StackPanel Orientation="Vertical">
                                                        <Image Source="../image/delete.png" Width="20" HorizontalAlignment="Left" Margin="5,1,0,7" />
                                                    </StackPanel>
                                                </Button>
                                            </DataTemplate>
                                        </data:DataGridTemplateColumn.CellTemplate>
                                    </data:DataGridTemplateColumn>
                                </data:DataGrid.Columns>
                            </data:DataGrid>
                        </Border>
                    </StackPanel>
                    <StackPanel Margin="10,0,0,0">
                        <Border>
                            <slc:CustomContentPanel Name="panelConsultasProdutos" HeaderPadding="10,5" Margin="10,5,0,0" 
                             BorderBrush="#FFD1D1D1" Header="Produtos / Modalidades" Visibility="Collapsed" CornerRadius="5">
                                <sdk:DataGrid AutoGenerateColumns="False" HorizontalAlignment="Center" Margin="5,5,0,0" Name="dataGridProdutos" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" MinHeight="50" MinWidth="100" MaxHeight="490">
                                    <data:DataGrid.Columns>
                                        <data:DataGridTextColumn Header="Produto" Binding="{Binding CdProduto}" MinWidth="100" IsReadOnly="True"></data:DataGridTextColumn>
                                        <data:DataGridTextColumn Header="Modalidade" Binding="{Binding CdModalidade}" MinWidth="100" IsReadOnly="True"></data:DataGridTextColumn>
                                    </data:DataGrid.Columns>
                                </sdk:DataGrid>

                            </slc:CustomContentPanel>
                        </Border>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Toolkit:BusyIndicator>
    </Grid>
</navigation:Page>
